// !@#$McCaBe-InStRuMeNtAtIoN$#@!
// Instrumented with the McCabe Java Parser
// Version: 8.1.0.1 - 20110309
// Using Path Vector Instrumentation
// Date: Sun Apr 01 2012 20:41:13
package EventManager;

import java.util.ArrayList;
import Driver.Facade;
import Model.Booking;

import com.mccabe.*;


class ViewBookingsForEventAdminRequest_ef2ceff0a017699fc59b237a8ad7f62b {
    static java.lang.Object info[];
    static {
        info = new java.lang.Object[2];
        info[0] = new Integer(-1);
        info[1] = new String("R:\\yu\\Concordia\\SOEN 344 Design II\\Term Assignment\\Code Repo\\trunk\\Iteration 3\\ERS\\src\\EventManager\\ViewBookingsForEventAdminRequest.java");
    }
}


public class ViewBookingsForEventAdminRequest extends AdminRequest 
{

	private int eventId;
	private ArrayList<Booking> bookings = null;
	
	public ViewBookingsForEventAdminRequest(Administrator issuer, int eventId) 
	{
		super(issuer);
int _mcFreq_94ee31cbcf5b71493605b0898950ef12[] = PathVec_ERS_Iter3.getIntArray(0);
PathVec_ERS_Iter3.releaseIntArray();
PathVec_ERS_Iter3.enterConstructorWithECC(ViewBookingsForEventAdminRequest_ef2ceff0a017699fc59b237a8ad7f62b.info,0,_mcFreq_94ee31cbcf5b71493605b0898950ef12,0);
		
		this.eventId = eventId;
	}

	public int getEventId() 
	{
int _mcFreq_7c94c9a09bc176026e77cbc9781771b7[] = new int[1];
PathVec_ERS_Iter3.enterMethod(ViewBookingsForEventAdminRequest_ef2ceff0a017699fc59b237a8ad7f62b.info,1,_mcFreq_7c94c9a09bc176026e77cbc9781771b7,0);

		return eventId;
	}

	public void setEventId(int eventId) 
	{
int _mcFreq_dad18565a749e364d9215a2c1408f1da[] = new int[1];
PathVec_ERS_Iter3.enterMethod(ViewBookingsForEventAdminRequest_ef2ceff0a017699fc59b237a8ad7f62b.info,2,_mcFreq_dad18565a749e364d9215a2c1408f1da,0);

		this.eventId = eventId;
	}
	
	/**
	 * Returns the bookings list
	 * @return List of bookings if the request was sustained, null otherwise
	 */
	public ArrayList<Booking> getBookings() 
	{
int _mcFreq_6fdc41eedb64d770e10dde6b5113c79b[] = new int[1];
PathVec_ERS_Iter3.enterMethod(ViewBookingsForEventAdminRequest_ef2ceff0a017699fc59b237a8ad7f62b.info,3,_mcFreq_6fdc41eedb64d770e10dde6b5113c79b,0);

		return bookings;
	}

	public void setBookings(ArrayList<Booking> bookings) 
	{
int _mcFreq_5fb40caa7369a60ddd46011350efd26d[] = new int[1];
PathVec_ERS_Iter3.enterMethod(ViewBookingsForEventAdminRequest_ef2ceff0a017699fc59b237a8ad7f62b.info,4,_mcFreq_5fb40caa7369a60ddd46011350efd26d,0);

		this.bookings = bookings;
	}

	@Override
	public String toString() 
	{
int _mcFreq_3181a32aa2e6adec311b009365ce8eb6[] = new int[1];
PathVec_ERS_Iter3.enterMethod(ViewBookingsForEventAdminRequest_ef2ceff0a017699fc59b237a8ad7f62b.info,5,_mcFreq_3181a32aa2e6adec311b009365ce8eb6,0);

		return "ViewBookingsForEventRequest for event ID " + eventId;
	}
	
	@Override
	public void process(Administrator issuer)
	{
int _mcFreq_aa44e1c5afc9bc00993068b440f02b3f[] = new int[8];
PathVec_ERS_Iter3.enterMethod(ViewBookingsForEventAdminRequest_ef2ceff0a017699fc59b237a8ad7f62b.info,6,_mcFreq_aa44e1c5afc9bc00993068b440f02b3f,0);

		
{boolean __MCCABE_SKIPNEXT_EVENT_17 = false;
try {try
		{
			super.process(issuer);
			ArrayList<Booking> allBookings = Facade.getManager().getBookings();
			ArrayList<Booking> bookingForSpecifiedEvent = new ArrayList<Booking>();
			
{
for (Booking b : allBookings)
			{
PathVec_ERS_Iter3.decision(ViewBookingsForEventAdminRequest_ef2ceff0a017699fc59b237a8ad7f62b.info,6,_mcFreq_aa44e1c5afc9bc00993068b440f02b3f,1,0,true);

				if (
PathVec_ERS_Iter3.decision(ViewBookingsForEventAdminRequest_ef2ceff0a017699fc59b237a8ad7f62b.info,6,_mcFreq_aa44e1c5afc9bc00993068b440f02b3f,3,4,
PathVec_ERS_Iter3.testCondition(b.getEvent().getId() == getEventId()
))
)
				{
					bookingForSpecifiedEvent.add(b);
				}
			}
PathVec_ERS_Iter3.decision(ViewBookingsForEventAdminRequest_ef2ceff0a017699fc59b237a8ad7f62b.info,6,_mcFreq_aa44e1c5afc9bc00993068b440f02b3f,2,0,true);

}

			setBookings(bookingForSpecifiedEvent);
			setStatus(RequestStatus.Sustained);
		}
		catch (Exception e)
		{
PathVec_ERS_Iter3.decision(ViewBookingsForEventAdminRequest_ef2ceff0a017699fc59b237a8ad7f62b.info,6,_mcFreq_aa44e1c5afc9bc00993068b440f02b3f,5,0,true);
__MCCABE_SKIPNEXT_EVENT_17 = true;

			setStatus(RequestStatus.Refused);
		}
if (!__MCCABE_SKIPNEXT_EVENT_17)

PathVec_ERS_Iter3.decision(ViewBookingsForEventAdminRequest_ef2ceff0a017699fc59b237a8ad7f62b.info,6,_mcFreq_aa44e1c5afc9bc00993068b440f02b3f,7,0,true);
__MCCABE_SKIPNEXT_EVENT_17 = true;

} finally {
    if (!__MCCABE_SKIPNEXT_EVENT_17)
        PathVec_ERS_Iter3.decision(ViewBookingsForEventAdminRequest_ef2ceff0a017699fc59b237a8ad7f62b.info,6,_mcFreq_aa44e1c5afc9bc00993068b440f02b3f,6,0,true);
}}

	}
	
	

}
